package com.example.mybatislearning.config;

import org.apache.ibatis.reflection.ExceptionUtil;
import org.mybatis.spring.SqlSessionTemplate;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zhangfei
 * @date 2024/1/4 11:08
 **/
public class TestMapperProxy<T> implements InvocationHandler, Serializable {

    private SqlSessionTemplate sqlSessionTemplate;
    public TestMapperProxy(SqlSessionTemplate sqlSessionTemplate){
        this.sqlSessionTemplate = sqlSessionTemplate;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (Object.class.equals(method.getDeclaringClass())) {
            return method.invoke(this, args);
        } else {
            return "hello world";
        }
    }
}
